package org.come.Jpanel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;

import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;

import org.come.until.ScrollUI;
import org.come.until.SrcollPanelUI;

import com.tool.btn.FormsOnOffBtn;
import com.tool.btn.RoleCaoZuoBtn;
import com.tool.tcpimg.UIUtils;


public class ApointJpanel extends JPanel {

	private RoleCaoZuoBtn btnqueren,// 确认按钮
	btnquxiao;// 取消按钮
	
	private JLabel labname,//名称
	labRace,//种族
	labLevel;//等级
	
	// 列表
	private JList<String> listposition;// 放置帮派职位的列表
	// 列表中的对象
	private DefaultListModel<String> listModel;// 放置帮派职位的列表对象

	// 列表中对象的名字颜色
	private Color fontcolor;
	// 滚动条
	private JScrollPane jScrollPane;// 放置帮派职位的列表滚动条

	public ApointJpanel() throws Exception {

		this.setPreferredSize(new Dimension(294, 344));
		this.setLayout(null);
		this.setBackground(UIUtils.Color_BACK);

		
		//关闭按钮事件
		FormsOnOffBtn offBtn=new FormsOnOffBtn("inkImg/hongmu/1/s74.png", 1,37);
		offBtn.setBounds(274, 0, 25, 25);
		this.add(offBtn);

		listModel = new DefaultListModel<String>();
		listModel.add(0, "护法");
		listModel.add(1, "长老");
		listModel.add(2, "堂主");

		listModel.add(3, "香主");
		listModel.add(4, "精英");
		listModel.add(5, "帮众");

		//名称
		labname = new JLabel();
		labname.setBounds(96,45,150,16);
		labname.setForeground(Color.WHITE);
		labname.setFont(new Font("微软雅黑", 0, 14));
		this.add(labname);
		
		//种族
		labRace = new JLabel();
		labRace.setBounds(96,77,150,16);
		labRace.setForeground(Color.WHITE);
		labRace.setFont(new Font("微软雅黑", 0, 14));
		this.add(labRace);
		
		//等级
		labLevel = new JLabel();
		labLevel.setBounds(96,108,150,16);
		labLevel.setForeground(Color.WHITE);
		labLevel.setFont(new Font("微软雅黑", 0, 14));
		this.add(labLevel);
		
		// 确认按钮
		btnqueren = new RoleCaoZuoBtn("inkImg/hongmu/1/6026.png", 1, "确认", 0,UIUtils.COLOR_BTNPUTONG);
		btnqueren.setBounds(48, 307, 68, 26);
		this.add(btnqueren);
		// 取消按钮
		btnquxiao = new RoleCaoZuoBtn("inkImg/hongmu/1/6026.png", 1, "取消", 1,UIUtils.COLOR_BTNPUTONG);
		btnquxiao.setBounds(153, 307, 68, 26);
		this.add(btnquxiao);

		// 帮派职位列表
		listposition = new JList<String>() {
            {
				setOpaque(false);
			} // instance initializer
		};
		listposition.setSelectionBackground(new Color(33, 42, 52));
		fontcolor = Color.GREEN;
		listposition.setSelectionForeground(fontcolor);
		listposition.setForeground(fontcolor);
		listposition.setFont(new Font("楷体", 1, 16));
		listposition.setBackground(UIUtils.Color_BACK); // 设置列表框为透明背景
		listposition.setModel(listModel);

		// 帮派职位列表滚动条
		jScrollPane = new JScrollPane(listposition);
		jScrollPane.setVerticalScrollBarPolicy(21);
		jScrollPane.getVerticalScrollBar().setUI(new ScrollUI());
		jScrollPane.getViewport().setOpaque(false);
		jScrollPane.setOpaque(false);
		jScrollPane.setBounds(37, 163, 216, 129);
		jScrollPane.setBorder(BorderFactory.createEmptyBorder());
		jScrollPane.setBorder(BorderFactory.createLineBorder(new Color(31, 7, 8)));
		jScrollPane.setHorizontalScrollBarPolicy(31);
		this.add(jScrollPane);

	}
	public static int index=0;
	private ImageIcon icon;
	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		if (icon==null) {
			icon=new ImageIcon("inkImg/hongmu/2/21_png.xy2uiimg.grouptitle.png");
		}
		// 任命
		g.drawImage(icon.getImage(), 0, 0, 294, 344, this);
	}

	public RoleCaoZuoBtn getBtnqueren() {
		return btnqueren;
	}

	public void setBtnqueren(RoleCaoZuoBtn btnqueren) {
		this.btnqueren = btnqueren;
	}

	public RoleCaoZuoBtn getBtnquxiao() {
		return btnquxiao;
	}

	public void setBtnquxiao(RoleCaoZuoBtn btnquxiao) {
		this.btnquxiao = btnquxiao;
	}

	public JList<String> getListposition() {
		return listposition;
	}

	public void setListposition(JList<String> listposition) {
		this.listposition = listposition;
	}

	public JList<String> getListpet() {
		return listposition;
	}

	public void setListpet(JList<String> listpet) {
		this.listposition = listposition;
	}

	public DefaultListModel<String> getListModel() {
		return listModel;
	}

	public void setListModel(DefaultListModel<String> listModel) {
		this.listModel = listModel;
	}

	public Color getFontcolor() {
		return fontcolor;
	}

	public void setFontcolor(Color fontcolor) {
		this.fontcolor = fontcolor;
	}

	public JScrollPane getjScrollPane() {
		return jScrollPane;
	}

	public void setjScrollPane(JScrollPane jScrollPane) {
		this.jScrollPane = jScrollPane;
	}

	public JLabel getLabname() {
		return labname;
	}

	public void setLabname(JLabel labname) {
		this.labname = labname;
	}

	public JLabel getLabRace() {
		return labRace;
	}

	public void setLabRace(JLabel labRace) {
		this.labRace = labRace;
	}

	public JLabel getLabLevel() {
		return labLevel;
	}

	public void setLabLevel(JLabel labLevel) {
		this.labLevel = labLevel;
	}



}
